#include "diamond.h"

diamond::diamond()
{
    //钻石资源加载
     m_diamond.load(":/myImage/images/钻石.png");

     //钻石位置
     m_X = 0;
     m_Y = 0;

     //钻石状态
     m_Free = true;

     //钻石速度
     m_Speed = 5;  //炸弹速度为5

     //钻石矩形
     m_Rect.setWidth(m_diamond.width());
     m_Rect.setHeight(m_diamond.height());
     m_Rect.moveTo(m_X,m_Y);
}

void diamond::updatePosition()
{
    //空闲状态，不计算坐标
    if(m_Free)
    {
        return;
    }

    m_Y += m_Speed;
    m_Rect.moveTo(m_X,m_Y);

    if(m_Y >= 768 + m_Rect.height())
    {
        m_Free = true;
    }
}
